﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>@ViewBag.Title - MEB文章采编系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>
    <ul class="layui-nav">
        <li style="display:inline-block;width:180px;vertical-align:bottom;padding-bottom:18px;"><a href="/" style="color:#eee;font-size:20px;font-family:'Microsoft YaHei UI';">MEB文章采编系统</a></li>
        @*<li class="layui-nav-item"><a href="">最新活动</a></li>
            <li class="layui-nav-item layui-this">
                <a href="javascript:;">产品</a>
                <dl class="layui-nav-child">
                    <dd><a href="">选项1</a></dd>
                    <dd><a href="">选项2</a></dd>
                    <dd><a href="">选项3</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">大数据</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">解决方案</a>
                <dl class="layui-nav-child">
                    <dd><a href="">移动模块</a></dd>
                    <dd><a href="">后台模版</a></dd>
                    <dd class="layui-this"><a href="">选中项</a></dd>
                    <dd><a href="">电商平台</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">社区</a></li>*@
        @if (Request.IsAuthenticated)
        {
            <li class="layui-nav-item">
                @Html.ActionLink(User.Identity.Name, "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
            </li>
            <li class="layui-nav-item">
                @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
                {@Html.AntiForgeryToken()}<a href="javascript:document.getElementById('logoutForm').submit()">注销</a>
            </li>
        }
        else
        {
            <li class="layui-nav-item">@Html.ActionLink("注册", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
            <li class="layui-nav-item">@Html.ActionLink("登录", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
        }
    </ul>
    <ul class="layui-nav layui-nav-tree" lay-filter="demo" style="position:absolute;top:60px;bottom:-60px;">
        @if (Request.IsAuthenticated)
        {
            @*<li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">文章</a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">选项二</a></dd>
                        <dd><a href="javascript:;">选项三</a></dd>
                        <dd><a href="/articles/index">文章管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">解决方案</a>
                    <dl class="layui-nav-child">
                        <dd><a href="">移动模块</a></dd>
                        <dd><a href="">后台模版</a></dd>
                        <dd><a href="">电商平台</a></dd>
                    </dl>
                </li>*@
            <li class="layui-nav-item"><a href="javascript:;" data-url="/articlecategories">文章分类</a></li>
            <li class="layui-nav-item"><a href="javascript:;" data-url="/articles">文章管理</a></li>
            <li class="layui-nav-item"><a href="javascript:;" data-url="/articletags">标签管理</a></li>
            <li class="layui-nav-item"><a href="javascript:;" data-url="/articlefragments">片段管理</a></li>
            <li class="layui-nav-item"><a href="javascript:;" data-url="/articles/similarity?s=85">相似文章</a></li>
            if (User.IsAdministrator())
            {
                <li class="layui-nav-item"><a href="javascript:;" data-url="/account/TokenLoginAuthorization">登录授权</a></li>
            }
        }
        }
    </ul>
    <div id="main" style="margin-left:200px; padding:20px;margin-top:0px;opacity:0;">
        @RenderBody()
    </div>
    <script src="/layui/layui.js" charset="utf-8"></script>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script>
        var app = {};
        app.use = function (m) {
            return layui.config({ base: '/content/modules/' }).use(m);
        };
        app.syncPost = function (url, data) {
            return $.ajax({ cache: false, type: "post", url: url, data: data, async: false });
        }
        app.syncGet = function (url, data) {
            return $.ajax({ cache: false, type: "get", url: url, data: data, async: false });
        }
        app.model = { id: null };
        app.use('shared/layout');
        app.animateHide = function (callback) {
            $('#main').animate({ 'margin-top': '10px', 'opacity': '0' }, 'fast', function () { $(this).hide(); callback(); });
        };
        layui.use('element', function () {
            var element = layui.element();
            $('.layui-nav-item a[data-url="' + location.pathname + '"]').parent().addClass('layui-this');
        });

        $('.del-btn').click(function (e) {
            e.preventDefault();
            var url = $(this).attr('href');
            e.preventDefault();
            var text = app.syncGet(url).responseText;
            var d = JSON.parse(text);
            var token = d.msg;
            layer.confirm('确定删除？', {
                btn: ['嗯', '取消'] //按钮
            }, function () {
                $.post(url,
                    { '__RequestVerificationToken': token },
                    function (data) {
                        layer.msg(data.msg, { icon: 1 });
                        app.animateHide(function () {
                            location.reload();
                        });
                    });
            });
        });
        $('#main').animate({ opacity: 1 });
    </script>

    @RenderSection("scripts", required: false)
</body>
</html>